﻿using System.Web.Mvc;
using INSE6260.OnlineBanking.Infrastructure;
using INSE6260.OnlineBanking.Service.Interfaces;
using INSE6260.OnlineBanking.Model.Payee;
using System.Collections.Generic;

namespace INSE6260.OnlineBanking.Controllers.Controllers
{
    public class PayeeController : Controller
    {
        private readonly IPayeeService _payeeService;
        private readonly IUnitOfWork _unitOfWork;
        public PayeeController(IPayeeService payeeService, IUnitOfWork unitOfWork)
        {
            _unitOfWork = unitOfWork;
            _payeeService = payeeService;
        }
        public ActionResult Index()
        {
            var payees = _payeeService.GetAllPayee();
            return View(payees);
        }
        public ActionResult Create()
        {
            var test = new List<PayeeName> { new PayeeName { Name = "AAAA", Id = 1 }, new PayeeName { Name = "BBBB", Id = 2 } };
            ViewBag.PayeeNames = test;
            return View();
        }
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Create(Payee payee)
        {
            if (ModelState.IsValid)
            {
                //
                return RedirectToAction("Index", "Client");
            }
            return View(payee);
        }

    }
}
